package com.nuoniu.sibanyun.mapper.crm;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.nuoniu.sibanyun.entity.SysCompany;
import com.nuoniu.sibanyun.entity.crm.CrmGoodsOrder;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Component;

/**
 * <p>
 * 商品订单 Mapper 接口
 * </p>
 *
 * @author baiqiang
 * @since 2020-07-17
 */
@Component
@Mapper
public interface CrmGoodsOrderMapper extends BaseMapper<CrmGoodsOrder> {

    /**
     * 获取最新订单号
     * @author 小啊刚
     * @date 2020-07-21
     */
    @Select("select order_no from crm_goods_order where date(create_date) = date(now()) order by create_date desc limit 1")
    String getOrderNo();

    @Update("update crm_goods_order set company_name = #{companyName} where company_id = #{id}")
    void updateCompanyName(SysCompany company);
}
